<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">go</button>
    <script>
        const btn = document.getElementById("btn")
        const handle = ()=>{
            console.log("出发了");
        }
        btn.addEventListener("click",throttle(handle,1000))
        function throttle(handle,time){
            let perTime = null
            return function(){
              nowtime = Date.now()
              if(nowtime - perTime>time){
                handle()
                perTime = nowtime                               //节流就是卡时间，不过指定的时间不让你执行第二次 ，技能冷却
              }                                                         
            }
        }
    </script>
</body>
</html>